﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.Entity;
using ClassLibrary.DAO;
using ClassLibrary.Data;
using System.Globalization;

public partial class UserControl_ActionList1 : System.Web.UI.UserControl
{
    TblJobNoteDAO JobNoteDAO = new TblJobNoteDAO(Global.CONNECTION_STRING);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadJobNote();
        }
    }

    private void LoadJobNote()
    {
        string id = Request.QueryString["id"];
        grdAction.DataSource = JobNoteDAO.GetJobNotes(Convert.ToInt32(id));
        grdAction.DataBind();
    }

    protected void grdAction_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            e.Row.Cells[2].Text = Convert.ToDateTime(e.Row.Cells[2].Text).ToString("dd/MM/yyyy");

            HiddenField hidItemID1 = (HiddenField)e.Row.Cells[0].FindControl("hirID1");
            hidItemID1.Value = DataBinder.Eval(e.Row.DataItem, "IDJobNote").ToString();
            int idJobNoteID = Convert.ToInt32(hidItemID1.Value);


            HiddenField hidItemID = (HiddenField)e.Row.Cells[1].FindControl("hirID");
            hidItemID.Value = DataBinder.Eval(e.Row.DataItem, "JobID").ToString();
            int id = Convert.ToInt32(hidItemID.Value);
            HyperLink hyper = (HyperLink)e.Row.Cells[6].FindControl("hypStatus");
            hyper.NavigateUrl = "~/Admin/ActionList.aspx?keepThis=true&TB_iframe=true&width=700&height=500&id=" + id + "&idJobNote=" + idJobNoteID;
        }
    }
}
